package it.sebsibenal.server.controller;

import it.sebsibenal.server.MailService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class SendEmailController extends AbstractController {

	private MailService mailService;
	
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception {
		mailService.inviaEmailGenerica(request.getParameter("subject"), request.getParameter("body"));
		return new ModelAndView("redirect:email.shtml");
	}

	public void setMailService(MailService mailService) {
		this.mailService = mailService;
	}
	
}
